package per.chao.mqtt.infrastructure.common.config;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * Description:
 *
 * @author W.Chao
 * @date 2021/6/20 20:01
 **/
@Setter
@Getter
@ToString
@ConfigurationProperties("mqtt")
@Component
public class NettyMqttProperties {
	private boolean enable = true;
	private String bindAddress;
	private int listenerPort;
	private int timeout = 10_000;
	private NettyServerProperties netty;

	@Getter
	@Setter
	@ToString
	@ConfigurationProperties("mqtt.netty")
	@Component
	public static class NettyServerProperties {
		private String leakDetectorLevel;
		private int bossGroupThreadCount = 1;
		private int workGroupThreadCount = Runtime.getRuntime().availableProcessors() * 2;
		private int maxPayloadSize = 65535;
	}
}
